checkPermission

open fun checkPermission(@NonNull context: Context, @NonNull permission: String, pid: Int, uid: Int, @Nullable packageName: String): Int(source)

Checks whether a given package in a UID and PID has a given permission and whether the app op that corresponds to this permission is allowed.

Return

The permission check result which is either PERMISSION_GRANTED or PERMISSION_DENIED or PERMISSION_DENIED_APP_OP.

Parameters

context

Context for accessing resources.

permission

The permission to check.

pid

The process id for which to check.

uid

The uid for which to check.

packageName

The package name for which to check. If null the the first package for the calling UID will be used.